"""meiduo_mall URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
import xadmin
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from goods.views import SKUSearchViewSet

urlpatterns = [
    # path('authorizations/', obtain_jwt_token),                # jwt认证地址，已经重写了方法，在users的APP中实现地
    path('admin/', admin.site.urls),
    path('xadmin/', xadmin.site.urls),
    path('', include('users.urls')),
    path('ckeditor/', include('ckeditor_uploader.urls')),       # rich text edit 路由
    path('oauth/', include('oauth.urls')),     # QQ认证
    path('areas/', include('areas.urls')),
    path('addresses/', include('address.urls')),
    path('categories/', include('goods.urls')),
    path('cart/', include('carts.urls')),
    path('orders/', include('orders.urls')),
    path('payment/', include('payment.urls')),
]

router = DefaultRouter()
router.register('skus/search', SKUSearchViewSet, base_name='skus_search')       # 用于全文搜索，其中skus是可变的，search是固定的
urlpatterns.extend(router.urls)
